using System;

/// <summary>
/// 
/// </summary>
namespace FamilyTree_v1._0
{
    public class BinaryNode
    {
        private Person data;
        public Person Data
        {
            get { return data; }
            set { data = value; }
        }

        private BinaryNode parentNode;

        public BinaryNode ParentNode
        {
            get { return parentNode; }
            set { parentNode = value; }
        }

        private BinaryNode leftNode;

        public BinaryNode LeftNode
        {
            get { return leftNode; }
            set { leftNode = value; }
        }

        private BinaryNode rightNode;

        public BinaryNode RightNode
        {
            get { return rightNode; }
            set { rightNode = value; }
        }
        public BinaryNode()
        {

        }
        public BinaryNode(Person aPerson)
        {
            this.Data = aPerson;
            this.LeftNode = this.RightNode = null;
        }

        public void AddLeft(Person aPerson)
        {
            BinaryNode newNode = new BinaryNode(aPerson);
            this.LeftNode = newNode;
        }
        public void AddRight(Person aPerson)
        {
            BinaryNode newNode = new BinaryNode(aPerson);
            this.RightNode = newNode;
        }

        public void DuyetCay()
        {
            if (this.Data == null)
                return;
            LeftNode.DuyetCay();
            //xu ly
            RightNode.DuyetCay();
        }
    }
}